package renderer
{
  import event.DeleteItemEvent;
  
  import flash.events.MouseEvent;
  
  import mx.controls.Image;

  public class DeleteItemRenderer extends Image
  {
    [Embed(source="assets/imagesdelete.png")]
    private var imageSource:Class;

    public function DeleteItemRenderer()
    {
      super();
      source = imageSource;
      scaleContent = false;
      useHandCursor = true;
      mouseChildren = false;
      toolTip = "Clic to delete the item";
      setStyle("verticalAlign", "middle");
      setStyle("horizontalAlign", "center");
      addEventListener(MouseEvent.CLICK, mouseClickHandler);
    }

    private function mouseClickHandler(event:MouseEvent):void
    {
      var evt:DeleteItemEvent = new DeleteItemEvent(listData.rowIndex, data, true, true);
      dispatchEvent(evt);
    }

  }
}